//
// example 11.1rx - http://tronixstuff.com/tutorials > Chapter 11
// 
// basic rx sketch - based on code by Mike McCauley 2010 http://www.open.com.au/mikem/arduino
//
//

// Need these lines below ///////////////////
#include <VirtualWire.h>  
#undef int
#undef abs
#undef double
#undef float
#undef round
////////////////////////////////////////////
void setup()
{
  Serial.begin(9600);    

  // wake up the wireless receiver
  vw_set_ptt_inverted(true);    // need this line
  vw_setup(2400);               // sets speed of data reception. 
  vw_set_rx_pin(0);             // this is the RX pin number - 0 on a Duemilanove
  vw_rx_start();                // start the receiver!
}

void loop()
{
  uint8_t buf[VW_MAX_MESSAGE_LEN]; // this is an array of unsigned integers 8-bits long. In other words, bytes between 0 and 65535
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(buf, &buflen)) // check to see if there is received data in the buffer
  {
    for (int i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);  // display the received data from the buffer
    }
    Serial.println("");
  }
}

